<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../../../assets/docs.css" rel="stylesheet" type="text/css" media="screen" />
<title>MooTools 1.3 Documentation - Core/Core</title>
</head>

<body>
  <div class="doc">
    <div class="methods">
      <h4 class="menu-item"><a href="#Core">Core</a></h4>
      <div class="menu-item"><a href="#Core:typeOf">typeOf</a></div>
      <div class="menu-item"><a href="#Core:instanceOf">instanceOf</a></div>
      <h4 class="menu-item"><a href="#Deprecated-Functions">Deprecated.Functions</a></h4>
      <div class="menu-item"><a href="#Deprecated-Functions:chk">chk</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:clear">clear</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:defined">defined</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:arguments">arguments</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:empty">empty</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:lambda">lambda</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:extend">extend</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:merge">merge</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:each">each</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:pick">pick</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:random">random</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:splat">splat</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:time">time</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:try">try</a></div>
      <div class="menu-item"><a href="#Deprecated-Functions:type">type</a></div>
    </div>
    <div class="l-border r-border span-15 content">
      <h1 id="Core"><a href="#Core">Type: Core</a></h1>
      <p class="description">Core contains a handful of common sense functions used in <a target="_blank" href="http://mootools.net">MooTools</a>.</p>
      <h2 id="Core:typeOf"><a href="#Core:typeOf">Function: typeOf</a></h2>
      <p class="description">Returns the type of object that matches the item passed in.</p>
      <h3>Syntax:</h3>
      <pre class="javascript"><span class="kw1">typeOf</span><span class="br0">(</span>obj<span class="br0">)</span>;
</pre>
      <h3>Arguments:</h3>
      <ol>
        <li>obj - (<em>object</em>) The object to inspect.</li>
      </ol>
      <h3>Returns:</h3>
      <ul>
        <li>'element'    - (<em>string</em>) If object is a DOM element node.</li>
        <li>'textnode'   - (<em>string</em>) If object is a DOM text node.</li>
        <li>'whitespace' - (<em>string</em>) If object is a DOM whitespace node.</li>
        <li>'arguments'  - (<em>string</em>) If object is an arguments object.</li>
        <li>'array'      - (<em>string</em>) If object is an array.</li>
        <li>'object'     - (<em>string</em>) If object is an object.</li>
        <li>'string'     - (<em>string</em>) If object is a string.</li>
        <li>'number'     - (<em>string</em>) If object is a number.</li>
        <li>'date'       - (<em>string</em>) If object is a date.</li>
        <li>'boolean'    - (<em>string</em>) If object is a boolean.</li>
        <li>'function'   - (<em>string</em>) If object is a function.</li>
        <li>'regexp'     - (<em>string</em>) If object is a regular expression.</li>
        <li>'class'      - (<em>string</em>) If object is a Class (created with new Class, or the extend of another class).</li>
        <li>'collection' - (<em>string</em>) If object is a native htmlelements collection, such as childNodes, getElementsByTagName, etc.</li>
        <li>'window'     - (<em>string</em>) If object is the window object.</li>
        <li>'document'   - (<em>string</em>) If object is the document object.</li>
        <li>'event'      - (<em>string</em>) If object is an event.</li>
        <li>false        - (<em>boolean</em>) If object is undefined, null, NaN or none of the above.</li>
      </ul>
      <h3>Example:</h3>
      <pre class="javascript"><span class="kw2">var</span> myString = <span class="st0">'hello'</span>;
<span class="kw1">typeOf</span><span class="br0">(</span>myString<span class="br0">)</span>; <span class="co1">// returns "string".</span>

</pre>
      <h3>Notes:</h3>
      <p>This method is equivalent to <em>$type</em> from MooTools 1.2.</p>
      <h2 id="Core:instanceOf"><a href="#Core:instanceOf">Function: instanceOf</a></h2>
      <p class="description">Checks to see if an object is an instance of a particular Type.</p>
      <h3>Syntax:</h3>
      <pre class="javascript"><span class="kw1">instanceOf</span><span class="br0">(</span><span class="kw1">item</span>, object<span class="br0">)</span>
</pre>
      <h3>Arguments:</h3>
      <ol>
        <li>item - (<em>mixed</em>) The item which you want to check</li>
        <li>object - (<em>mixed</em>) The Type you wish to compare with</li>
      </ol>
      <h3>Returns:</h3>
      <ul>
        <li>(<em>boolean</em>) Whether or not the item is an instance of the object.</li>
      </ul>
      <h3>Examples:</h3>
      <pre class="javascript"><span class="kw2">var</span> foo = <span class="br0">[</span><span class="br0">]</span>;
<span class="kw1">instanceOf</span><span class="br0">(</span>foo, Array<span class="br0">)</span>  <span class="co1">// returns true</span>
<span class="kw1">instanceOf</span><span class="br0">(</span>foo, String<span class="br0">)</span> <span class="co1">// returns false</span>

&nbsp;
<span class="kw2">var</span> myClass = <span class="kw2">new</span> <span class="kw2">Class</span><span class="br0">(</span><span class="br0">)</span>;
<span class="kw2">var</span> bar = <span class="kw2">new</span> myClass<span class="br0">(</span><span class="br0">)</span>;

<span class="kw1">instanceOf</span><span class="br0">(</span>bar, myClass<span class="br0">)</span>    <span class="co1">// returns true</span>
</pre>
      <h1 id="Deprecated-Functions"><a href="#Deprecated-Functions">Deprecated Functions</a></h1>
      <h2 id="Deprecated-Functions:chk" class="description"><a href="#Deprecated-Functions:chk">Function: $chk</a></h2>
      <p class="description">This method has been deprecated and will have no equivalent in MooTools 2.0.</p>
      <p>If you really need this function you can implement it like so:</p>
      <h3>Example:</h3>
      <pre class="javascript"><span class="kw2">var</span> $chk = <span class="kw2">function</span><span class="br0">(</span>obj<span class="br0">)</span><span class="br0">{</span>
    <span class="kw1">return</span> !!<span class="br0">(</span>obj || obj === <span class="nu0">0</span><span class="br0">)</span>;

<span class="br0">}</span>;
</pre>
      <h2 id="Deprecated-Functions:clear"><a href="#Deprecated-Functions:clear">Function: $clear</a></h2>
      <p class="description">This method has been deprecated. Please use <em>clearInterval</em> or <em>clearTimeout</em> instead.</p>
      <h3>See Also:</h3>
      <ul>
        <li> <a href="https://developer.mozilla.org/en/DOM/window.clearTimeout">MDC clearTimeout</a>, <a href="https://developer.mozilla.org/en/DOM/window.clearInterval">MDC clearInterval</a> </li>
      </ul>
      <h2 id="Deprecated-Functions:defined"><a href="#Deprecated-Functions:defined">Function: $defined</a></h2>
      <p class="description">This method has been deprecated.</p>
      <p>If you really need this function you can implement it like so:</p>
      <h3>Example:</h3>
      <pre class="javascript"><span class="kw2">var</span> $defined = <span class="kw2">function</span><span class="br0">(</span>obj<span class="br0">)</span><span class="br0">{</span>
    <span class="kw1">return</span> <span class="br0">(</span>obj != undefined<span class="br0">)</span>;

<span class="br0">}</span>;
&nbsp;
<span class="co1">// or just use it like this:</span>
<span class="kw1">if</span><span class="br0">(</span>obj != undefined<span class="br0">)</span><span class="br0">{</span>
    <span class="co1">// do something</span>
<span class="br0">}</span>
</pre>
      <h2 id="Deprecated-Functions:arguments"><a href="#Deprecated-Functions:arguments">Function: $arguments</a></h2>
      <p class="description">This method has been deprecated and will have no equivalent in MooTools 2.0.</p>
      <p>If you really need this function you can implement it like so:</p>
      <h3>Example:</h3>
      <pre class="javascript"><span class="kw2">var</span> $arguments = <span class="kw2">function</span><span class="br0">(</span>i<span class="br0">)</span><span class="br0">{</span>

    <span class="kw1">return</span> <span class="kw2">function</span><span class="br0">(</span><span class="br0">)</span><span class="br0">{</span>
        <span class="kw1">return</span> arguments<span class="br0">[</span>i<span class="br0">]</span>;
    <span class="br0">}</span>;

<span class="br0">}</span>;
</pre>
      <h2 id="Deprecated-Functions:empty"><a href="#Deprecated-Functions:empty">Function: $empty</a></h2>
      <p class="description">This method has been deprecated. Use <a href="../../../docs/core/Types/Function.html#Function:Function-from">Function.from</a> instead.</p>
      <h3>Example:</h3>
      <pre class="javascript"><span class="kw2">var</span> myFunc = <span class="kw2">Function</span>.<span class="me1">from</span><span class="br0">(</span><span class="br0">)</span>;

<span class="co1">// or better:</span>
<span class="kw2">var</span> myFunc = <span class="kw2">function</span><span class="br0">(</span><span class="br0">)</span><span class="br0">{</span><span class="br0">}</span>;
</pre>
      <h2 id="Deprecated-Functions:lambda"><a href="#Deprecated-Functions:lambda">Function: $lambda</a></h2>
      <p class="description">This method has been deprecated. Use <a href="../../../docs/core/Types/Function.html#Function:Function-from">Function.from</a> instead.</p>
      <h3>Example:</h3>
      <pre class="javascript">myLink.<span class="me1">addEvent</span><span class="br0">(</span><span class="st0">'click'</span>, <span class="kw2">Function</span>.<span class="me1">from</span><span class="br0">(</span><span class="kw2">false</span><span class="br0">)</span><span class="br0">)</span>; <span class="co1">// prevents a link Element from being clickable</span>

</pre>
      <h2 id="Deprecated-Functions:extend"><a href="#Deprecated-Functions:extend">Function: $extend</a></h2>
      <p class="description">This method has been deprecated. Please use <a href="../../../docs/core/Types/Object.html#Object:Object-append">Object.append</a> instead.</p>
      <h2 id="Deprecated-Functions:merge"><a href="#Deprecated-Functions:merge">Function: $merge</a></h2>
      <p class="description">This method has been deprecated. Please use <a href="../../../docs/core/Types/Object.html#Object:Object-merge">Object.merge</a> instead.</p>
      <h2 id="Deprecated-Functions:each"><a href="#Deprecated-Functions:each">Function: $each</a></h2>
      <p class="description">This method has been deprecated. Please use <a href="../../../docs/core/Types/Array.html#Array:Array-each">Array.each</a> or <a href="../../../docs/core/Types/Object.html#Object:Object-each">Object.each</a> instead.</p>
      <h2 id="Deprecated-Functions:pick"><a href="#Deprecated-Functions:pick">Function: $pick</a></h2>
      <p class="description">This method has been deprecated. Please use <a href="../../../docs/core/Types/Array.html#Array:pick">Array.pick</a> instead.</p>
      <h2 id="Deprecated-Functions:random"><a href="#Deprecated-Functions:random">Function: $random</a></h2>
      <p class="description">This method has been deprecated. Please use <a href="../../../docs/core/Types/Number.html#Number:Number-random">Number.random</a> instead.</p>
      <h2 id="Deprecated-Functions:splat"><a href="#Deprecated-Functions:splat">Function: $splat</a></h2>
      <p class="description">This method has been deprecated. Please use <a href="../../../docs/core/Types/Array.html#Array:Array-from">Array.from</a> instead.</p>
      <h2 id="Deprecated-Functions:time"><a href="#Deprecated-Functions:time">Function: $time</a></h2>
      <p class="description">This method has been deprecated. Please use <em>Date.now()</em> instead.</p>
      <h3>Syntax:</h3>
      <pre class="javascript"><span class="kw2">var</span> time = Date.<span class="me1">now</span><span class="br0">(</span><span class="br0">)</span>;

</pre>
      <h3>Returns:</h3>
      <ul>
        <li>(<em>number</em>) - The current timestamp.</li>
      </ul>
      <h2 id="Deprecated-Functions:try"><a href="#Deprecated-Functions:try">Function: $try</a></h2>
      <p class="description">This method has been deprecated. Please use <a href="../../../docs/core/Types/Function.html#Function:Function-attempt">Function.attempt</a> instead.</p>
      <h2 id="Deprecated-Functions:type"><a href="#Deprecated-Functions:type">Function: $type</a></h2>
      <p class="description">This method has been deprecated. Please use <a href="#Core:typeOf">typeOf</a> instead.</p>
    </div>
  </div>
<script type="text/javascript" src="../../../assets/mootools-core-1.3.js"></script>
<script type="text/javascript" src="../../../assets/mootools-more-smoothscroll.js"></script>
<script type="text/javascript" src="../../../assets/doc-assist.js"></script>
</body>
</html>
